@extends('teacher.base')
@section('main')
  
     <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
     <legend>材料管理</legend>
    </fieldset>

    <a href="{{asset('/Teacher/material/add')}}" class="layui-btn">添加材料</a>
 
    <div class="layui-form">
  <table class="layui-table">
    <colgroup>
      <col width="100">
      <col>
      <col width="200">
      <col width="250">
    </colgroup>
    <thead>
      <tr>
        <th>ID</th>
        <th>材料标题</th>
        <th>题目数</th>
        <th>加入时间</th>
        <th>操作</th>
      </tr> 
    </thead>
    <tbody>
    @foreach($materialAll as $v)
      <tr>
        <td>{{$v->id}}</td>
        <td>{{$v->title}}</td>
        <td>{{count($v->getQuestion)}}</td>
        <td>{{date('Y-m-d H:i:s',$v->add_time)}}</td>
        <td><a href="#" class="layui-btn layui-btn-primary layui-admin-cz">查看</a><a href="{{asset('Teacher/material/edit\/').$v->id}}" class="layui-btn layui-admin-cz">编辑</a><a href="{{asset('Teacher/material/del\/').$v->id}}" class="layui-btn layui-btn-danger layui-admin-cz">删除</a></td>
      </tr>
    @endforeach
    </tbody>
  </table>
</div>

<div class="admin_fy" id="admin_fy"></div>

<script>
layui.use(['laypage', 'layer','element'], function(){
  var laypage = layui.laypage
  ,element = layui.element
  ,layer = layui.layer;
  //总页数大于页码总数
  laypage.render({
    elem: 'admin_fy'
    ,count: {{$materialCount}} //数据总数
    ,curr: {{$materialAll->currentPage()}}
    ,jump: function(obj, first){
      
    //首次不执行
    if(!first){
      window.location.href="{{asset('/Teacher/material/list?page=')}}"+obj.curr;
    }

    }
  });
});
</script>
@endsection
